<template>
  <border-box title="内部选题">
    <a-empty v-if="topicInfo==null" description="无内部选题信息"></a-empty>
    <template v-else>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">选题名称：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.topicName}}</a-col>
      </a-row>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">作者：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.author}}</a-col>
      </a-row>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">创建时间：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.createTime}}</a-col>
      </a-row>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">选题类型：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.topicTypeName}}</a-col>
      </a-row>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">选题描述：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.topicDesc}}</a-col>
      </a-row>
      <a-row type="flex" class="item">
        <a-col v-bind="labelCol" class="label">备注：</a-col>
        <a-col flex="auto" class="value">{{topicInfo.remark}}</a-col>
      </a-row>
    </template>
  </border-box>
</template>

<script>
  //内部选题
  import BorderBox from "./BorderBox";
  import {getAction} from "@/api/manage";
  import {findTopicTypeName} from "@/utils/xinkeUtil";

  export default {
    name: "TaskInnerTopic",
    components: {BorderBox},
    props: ['params'],
    data() {
      return {
        labelCol: {sm: 15, md: 12, lg: 9, xl: 6},
        topicInfo: {}
      }
    },
    created() {
      this.queryInnerTopic();
    },
    methods: {
      queryInnerTopic() {
        getAction('task/taskInfo/queryTaskInnerTopic', this.params).then(res => {
          if (res.success) {
            if(res.result){
              res.result.topicTypeName = findTopicTypeName(res.result.topicType);
            }
            this.topicInfo = res.result;
          }
        })
      },
    }
  }
</script>

<style scoped>
  .item {
    flex-flow: unset;
    padding: 10px 0;
    font-size: 14px;
  }

  .label {
    color: rgba(0, 0, 0, .85);
    text-align: right;
  }

  .value {
    color: rgba(0, 0, 0, .65);
  }

</style>